/**
 * v-hasRole 角色权限处理
 */

import { checkRole } from './utils'

export default {
  mounted(el: HTMLElement, binding: { value: UserRoles }) {
    const { value } = binding
    if (!checkRole(value)) {
      el.parentNode && el.parentNode.removeChild(el)
    }
  }
}
